<?php
/* 
 * 商品分类
 */
class CategoryAction extends CommonAction {
    public function _filter(&$map) {
        $key = trim($_REQUEST['keywords']);
        //TODO
        if(!empty($key)) {
            $where['content'] = array('like',"%".$key."%");
            $where['subject'] = array('like',"%".$key."%");
            $where['address'] = array('like',"%".$key."%");
            $where['_logic'] = "or";
            $map['_complex'] = $where;
        }
        $map['user_id'] = $_SESSION[C('USER_AUTH_KEY')];
        

    }

     public function _before_add(){
        $this->assign('list',D('Category')->getAllCatalog(0,0));
    }

    public function _before_edit(){
         $this->assign('list',D('Category')->getAllCatalog(0,0));
    }

    public function index(){
        $model = D('Category');
        $menu = $model->getAllCatalog(0,0,3,0);
        Cookie::set("_currentUrl_",__SELF__);
        $this->assign('catalogList', $menu);
        $this->display();
    }
    
}
?>
